﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using RuleCode.Table;

namespace chatblog.login
{
    public partial class signin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text.Trim() == "")
            {
                MessageBox.Show(this.Form, "用户名不能为空.");
                return;
            }
            cbuser u = cbuser.Find(" cbuserid = '" + TextBox1.Text.Trim()+"'");
            if (u.Count > 0)
            {
                MessageBox.Show(this.Form, "用户名已经存在.");
                return;
            }
            else
            {
                u.cbuserid.Value = TextBox1.Text.Trim();
                u.cbusernickname.Value = TextBox2.Text.Trim();
                u.cbpassword.Value = u.GetRecID().ToString();
                u.jccreatedate.Value = DateTime.Now;
                u.jccreatetime.StringValue = DateTime.Now.ToLongTimeString();
                u.sendemail.Value = RuleCode.Enum.NoYes.Yes;
                u.jsr.Value = AliApi.appkey;
                u.Insert();
                cbuser.afterinsert(u);
                MessageBox.Show(this.Form, "注册成功,登录密码以及发送到你的邮箱中,谢谢.");
            }

        }
    }
}
